package com.fesine.utils;

import com.fesine.entity.Result;

/**
 * @description: 结果包装类
 * @author: Fesine
 * @createTime:2017/8/30 21:11
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2017/8/30 21:11
 */
public class ResultUtil {
    static Result result;

    /**
     * 带返回对象的成功
     * @param object
     * @return
     */
    public static Result success(Object object) {
        result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        result.setData(object);
        return result;
    }

    /**
     * 无对象的成功
     * @return
     */
    public static Result success() {
        return success(null);
    }

    /**
     * 失败返回
     * @param code
     * @param msg
     * @return
     */
    public static Result error(Integer code,String msg) {
        result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
